package cn.luke.basic.mapper;

import cn.luke.basic.entity.DtoRole;
import cn.luke.basic.entity.DtoUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by Luke on 2025/3/7 16:05.
 */
public interface MapperUser extends BaseMapper<DtoUser> {

    @Select("SELECT r.* FROM sys_role r " +
            "JOIN sys_user_role ur ON r.id = ur.role_id " +
            "WHERE ur.user_id = #{userId}")
    List<DtoRole> selectRolesByUserId(Long userId);

}
